#include "haptree.h"

int main(){
  HaplotypeCollection *hapCol;
  double freqs[32] ={0.25,0.25,0.25,0.25,1,0,1,0,
		     0,0,0,0,0,0,1,0,
		     1,1,1,1,1,1,1,1,
		     1,1,1,1,1,1,1,1};
  size_t alleles[]={0,0,1,1};
  PartialRead read1={0,2,1,alleles};
  PartialRead read2={0,2,1,&alleles[2]};
  PartialRead read3={0,1,1,alleles};
  PartialRead read4={0,1,1,&alleles[2]};
  Parameters pars={0.1,1.0, 0.0001};
  int code;
  size_t i;

  hapCol = createHaplotypeCollection(10);
  extendHaplotypes(hapCol, 2);
  extendHaplotypes(hapCol, 2);
  //printCollection(hapCol);
  setHaplotypeFreqs(hapCol, freqs);
  //  for(i=0; i < 2000000; ++i){
  code = addRead(hapCol,&read1);
  code = addRead(hapCol,&read2);
  code = addRead(hapCol,&read3);
  code = addRead(hapCol,&read4);
    //  }

  printCollection(hapCol);

  //printCollection(hapCol);
  
  //printf("Read added with code %d\n", code);
  for(i=0; i <10; ++i){
    printf("ITERATION %lu:\n", i);
    computeCollectionFreqs(hapCol, &pars, NULL);
    printCollection(hapCol);
  }


  //code = addRead(hapCol,&read);
  //printf("Read added with code %d\n", code);
  //printCollection(hapCol);
  destroyHaplotypeCollection(hapCol);
  

  return 0;
}
